import request from '@/utils/request'



// 新增组合套餐
export function newCombinationPackage (data) {
  console.log(data)
  return request({
    url: `/goods/portfolio`,
    method: 'post',
    data: data
  })
}
//  获取组合中商品列表
export function getCombinationGoodsList (promotionId, query) {
  return request({
    url: `/goods/portfolio/${promotionId}/list`,
    method: 'get',
    params: query
  })
}

//删除活动
export function deleteById(id){
  return request({
    url: `/goods/portfolio/${id}`,
    method: 'delete',
  })
}

//   修改组合套餐上架状态
export function updateListingState (id, data) {
  return request({
    url: `/goods/portfolio/${id}/marketEnable`,
    method: 'put',
    data: data
  })
}
//   删除组合套餐中的货品
export function delCombinationPackageGoods (portfolioId, goodsPortfolioId) {
  return request({
    url: `/goods/portfolio/${portfolioId}/${goodsPortfolioId}`,
    method: 'delete',
  })
}
//修改广告时间
export function handleTimeChange(id, startTime, endTime){
  const data = {
    startTime: startTime,
    endTime: endTime
  }
  return request({
    url: '/goods/portfolio/' + id + '/time',
    method: 'put',
    data: data
  })
}
//更换图片
export function handleImageChange(id, data){
  return request({
    url: '/goods/portfolio/' + id + '/image',
    method: 'put',
    data: data
  })
}
